<?php //debug($materiasNiveles);  ?>
<div class="row-fluid">
    <div class="span8">
        <h3 class="heading">Materias del Nivel <b><?php echo $materiasNiveles['0']['Nivele']['nombre']; ?></b></h3> 
        <?php if ($materiasNiveles): ?>
            <table class="table table-striped table-bordered dTableR" id="dt_a">
                <thead>
                    <tr>                                          
                        <th>Nombre</th>                                                             
                        <th>Acciones</th>
                    </tr>
                </thead>
                <tbody>
                    <?php foreach ($materiasNiveles as $mp): ?>
                        <?php $idMateriasNivele = $mp['MateriasNivele']['id']; ?>
                        <tr>                                                 
                            <td><?php echo $mp['Materia']['nombre']; ?></td>                        
                            <td>
                                <?php
                                echo $this->Html->image("iconos/elim.png", array(
                                    "title" => "Eliminar",
                                    'url' => array('action' => 'eliminarmateria', $idMateriasNivele, $idNivel)
                                ));
                                ?>                            
                            </td>
                        </tr>
                    <?php endforeach; ?>
                </tbody>
            </table>
        <?php else: ?>
            Este Nivel no Tiene Materias aun...
        <?php endif; ?>
    </div>   
</div>

<!-- sidebar -->
<?php echo $this->element('sidebar/listamaterias'); ?>
<!-- fin sidebar -->
<?php //llamamos scripts tablas ?>
<?php echo $this->element('jstablas'); ?>


<div>&nbsp</div>
<p>
<?php echo $this->Html->link('Nueva Materia al Curso', array('controller' => 'niveles', 'action' => 'asignamaterias', $idNivel), array('class' => 'btn btn-success')); ?>
</p>
<p>
<a href="<?php echo $this->Html->url(array('controller'=>'Niveles', 'action'=>'index'))?>" class="btn btn-inverse">Retornar al Registro de Cursos</a>
</p>